
var btnSb = false;//打卡上班
var btnXb = false;

function open(){
    console.info("fadfdafa")
    var tag = document.getElementById("sb");
    var sbTime = document.getElementById("sbTime");
    var judge = document.getElementById("ifSb")

    if(judge.value == "true"){
        sbTime.style.visibility = "visible";
        tag.innerText = "打卡成功"
        tag.classList.remove("btn-success")
        tag.classList.add("disabled")
    }

    tag = document.getElementById("xb");
    var xbTime = document.getElementById("xbTime");
    judge = document.getElementById("ifXb")
    if(judge.value == "true"){
        xbTime.style.visibility = "visible";
        tag.innerText = "打卡成功"
        tag.classList.remove("btn-success")
        tag.classList.add("disabled")
    }


}

function checkXb(){
    $.ajax({
        type: "post",
        url: "/checkXb",
        data:{},
        dataType:"json",
        success:function (result){
            return result.data
        }
    })
}
function afterSb(){
    var tag = document.getElementById("sb");
    var sbTime = document.getElementById("sbTime");
    sbTime.style.visibility = "visible";
    tag.innerText = "打卡成功"
    tag.classList.remove("btn-success")
    tag.classList.add("disabled")

}
function afterXb(){
    var tag = document.getElementById("xb");

    var xbTime = document.getElementById("xbTime");
    xbTime.style.visibility = "visible";
    tag.innerText = "打卡成功"
    tag.classList.remove("btn-success")
    tag.classList.add("disabled")
}


function sb(){

    var tag = document.getElementById("sb");
    var sbTime = document.getElementById("sbTime");
    // console.info(sbTime.innerText.length)
    // if(sbTime.innerText.length > 0){
    //     sbTime.style.visibility = "visible";
    //     tag.innerText = "打卡成功"
    //     tag.classList.remove("btn-success")
    //     tag.classList.add("disabled")
    // }


    $.ajax({
        type: "post",
        url: "/dakasb",
        data:{},
        dataType:"json",
        success:function (result){
            if(result.data){

                tag.innerText = "打卡成功"
                tag.classList.remove("btn-success")
                tag.classList.add("disabled")

                sbTime.style.visibility = "visible";
                sbTime.innerText = result.date


                btnSB = true
            }
        }
    })
}



function xb(){

    var tag = document.getElementById("xb");

    var xbTime = document.getElementById("xbTime");


    $.ajax({
        type: "post",
        url: "/dakaxb",
        data:{},
        dataType:"json",
        success:function (result){
            if(result.data){

                tag.innerText = "打卡成功"
                tag.classList.remove("btn-success")
                tag.classList.add("disabled")

                xbTime.style.visibility = "visible";
                xbTime.innerText = result.date


                btnXB = true
            }else{

            }
        }
    })
}